package erp_models

import (
	"time"
	"xiehui-service/app/models"
)

// 发货单
type OrderDelivery struct {
	models.ID
	LineId                string     `gorm:"column:line_id" json:"line_id"`                                 //产线id
	StationId             int64      `gorm:"column:station_id" json:"station_id"`                           //拌站ID
	UnionNo               string     `gorm:"column:union_no" json:"union_no"`                               //统一编号
	DeliveryNo            string     `gorm:"column:delivery_no" json:"delivery_no"`                         //发货单编号
	DispatchId            int64      `gorm:"column:dispatch_id" json:"dispatch_id"`                         //派车单ID
	DispatchNo            string     `gorm:"column:dispatch_no" json:"dispatch_no"`                         //派车单编号
	TaskId                int64      `gorm:"column:task_id" json:"task_id"`                                 //任务单ID
	TaskNo                string     `gorm:"column:task_no" json:"task_no"`                                 //任务单号
	VehicleNo             string     `gorm:"column:vehicle_no" json:"vehicle_no"`                           //车号
	Driver                int64      `gorm:"column:driver" json:"driver"`                                   //司机ID
	VehicleContacts       string     `gorm:"column:vehicle_contacts" json:"vehicle_contacts"`               //司机
	CustomerName          string     `gorm:"column:customer_name" json:"customer_name"`                     //客户名称
	ShippingAddress       string     `gorm:"column:shipping_address" json:"shipping_address"`               //收货地址
	ShippingContacts      string     `gorm:"column:shipping_contacts" json:"shipping_contacts"`             //收获联系人
	ShippingMobile        string     `gorm:"column:shipping_mobile" json:"shipping_mobile"`                 //收获联系电话
	HaulDistance          string     `gorm:"column:haul_distance" json:"haul_distance"`                     //运距
	ProjectName           string     `gorm:"column:project_name" json:"project_name"`                       //项目名称
	ProjectSubName        string     `gorm:"column:project_sub_name" json:"project_sub_name"`               //工程名称
	BuildPosition         string     `gorm:"column:build_position" json:"build_position"`                   //浇筑部位
	BuildMethod           string     `gorm:"column:build_method" json:"build_method"`                       //浇筑方式
	MortarMixtureNo       string     `gorm:"column:mortar_mixture_no" json:"mortar_mixture_no"`             //砂浆配比编号
	WorkMixtureNo         string     `gorm:"column:work_mixture_no" json:"work_mixture_no"`                 //施工配比编号
	ConcreteCategory      string     `gorm:"column:concrete_category" json:"concrete_category"`             //砼品种名称
	Strength              string     `gorm:"column:strength" json:"strength"`                               //强度等级
	MixerNo               string     `gorm:"column:mixer_no" json:"mixer_no"`                               //生产拌台
	PlanQuantity          float64    `gorm:"column:plan_quantity" json:"plan_quantity"`                     //计划方量
	DeliveryQuantity      float64    `gorm:"column:delivery_quantity" json:"delivery_quantity"`             //发货方量
	ConfirmQuantity       float64    `gorm:"column:confirm_quantity" json:"confirm_quantity"`               //签收方量
	LastRemainQuantity    float64    `gorm:"column:last_remain_quantity" json:"last_remain_quantity"`       //上次返料方量
	CurrentRemainQuantity float64    `gorm:"column:current_remain_quantity" json:"current_remain_quantity"` //本次返料方量
	DestroyQuantity       float64    `gorm:"column:destroy_quantity" json:"destroy_quantity"`               //报废方量
	CountQuantity         float64    `gorm:"column:count_quantity" json:"count_quantity"`                   //累计发货方量
	CountVehicle          int64      `gorm:"column:count_vehicle" json:"count_vehicle"`                     //累计发货车数
	IsWater               int64      `gorm:"column:is_water" json:"is_water"`                               //拉水
	IsPump                int64      `gorm:"column:is_pump" json:"is_pump"`                                 //拖泵
	DeliveryStatus        int8       `gorm:"column:delivery_status" json:"delivery_status"`                 //发货状态
	DeliveryTime          time.Time  `gorm:"column:delivery_time" json:"delivery_time"`                     //发货时间
	ProductionQuantity    float64    `gorm:"column:production_quantity" json:"production_quantity"`         //总生产方量
	ConcreteQuantity      float64    `gorm:"column:concrete_quantity" json:"concrete_quantity"`             //砼生产方量
	MortarQuantity        float64    `gorm:"column:mortar_quantity" json:"mortar_quantity"`                 //砂浆生产方量
	RemainQuantity        float64    `gorm:"column:remain_quantity" json:"remain_quantity"`                 //车上剩余方量
	ReturnQuantity        float64    `gorm:"column:return_quantity" json:"return_quantity"`                 //退料方量
	OtherQuantity         float64    `gorm:"column:other_quantity" json:"other_quantity"`                   //其他方量
	OtherRemark           string     `gorm:"column:other_remark" json:"other_remark"`                       //其他方量
	ReviewStatus          int8       `gorm:"column:review_status" json:"review_status"`                     //复核状态
	ReviewBy              int64      `gorm:"column:review_by" json:"review_by"`                             //复核人
	Remark                string     `gorm:"column:remark" json:"remark"`                                   //备注
	TglOrderId            string     `gorm:"column:tgl_order_id" json:"tgl_order_id"`                       //工控系统记录表ID
	ThOrderId             int64      `gorm:"column:th_order_id" json:"th_order_id"`                         //
	ThOrderNo             string     `gorm:"column:th_order_no" json:"th_order_no"`                         //
	StartTime             *time.Time `gorm:"column:start_time" json:"start_time"`                           //出厂时间
	ArriveTime            *time.Time `gorm:"column:arrive_time" json:"arrive_time"`                         //到达时间
	LeaveTime             *time.Time `gorm:"column:leave_time" json:"leave_time"`                           //离开时间
	SignTime              *time.Time `gorm:"column:sign_time" json:"sign_time"`                             //签收时间
	ReturnTime            *time.Time `gorm:"column:return_time" json:"return_time"`                         //回厂时间
	IsSign                int8       `gorm:"column:is_sign" json:"is_sign"`                                 //签收状态
	PrintCount            int8       `gorm:"column:print_count" json:"print_count"`                         //打印统计
	CancelType            int8       `gorm:"column:cancel_type" json:"cancel_type"`                         //取消类型
	FromId                int64      `gorm:"column:fromid" json:"fromid"`                                   //来源ID
	ToId                  int64      `gorm:"column:toid" json:"toid"`                                       //转出ID
	TenantId              string     `gorm:"column:tenant_id" json:"tenant_id"`                             //租户号
	Revision              int8       `gorm:"column:revision" json:"revision"`                               //乐观锁
	CreatedBy             int        `gorm:"column:created_by" json:"created_by"`                           //创建人
	UpdatedBy             int        `gorm:"column:updated_by" json:"updated_by"`                           //更新人
	DeletedBy             int        `gorm:"column:deleted_by" json:"deleted_by"`                           //删除人
	models.Timestamps
	models.SoftDeletes
	IsEdit                int8   `gorm:"column:is_edit" json:"is_edit"`                                   //是否修改过发货单
	ProConcreteCategoryId int64  `gorm:"column:pro_concrete_category_id" json:"pro_concrete_category_id"` //砼生产品种ID
	ProConcreteCategory   string `gorm:"column:pro_concrete_category" json:"pro_concrete_category"`       //砼生产品种
	ProMortarCategoryId   int64  `gorm:"column:pro_mortar_category_id" json:"pro_mortar_category_id"`     //砂浆生产品种ID
	ProMortarCategory     string `gorm:"column:pro_mortar_category" json:"pro_mortar_category"`           //砂浆生产品种
}

// TableName 解决gorm表明映射
func (OrderDelivery) TableName() string {
	return "order_delivery"
}
